using System;
using System.Threading;
using System.Web;

namespace Sedna.Core.Security
{
	/// <summary>
	/// a fake implementation of the IPrincipalInjector to be used
	/// for testing and debugging purposes only.
	/// </summary>
	public class NoPPrincipalInjector : IPrincipalInjector
	{
		public void BeforeRequest(HttpContext httpContext)
		{
            SednaWorkPrincipal principal = UserMapper.RestoreCurrentState();
            if (principal == null) return;
            Thread.CurrentPrincipal = principal;
            Thread.CurrentThread.CurrentCulture = principal.Culture;
            Thread.CurrentThread.CurrentUICulture = principal.Culture;
            HttpContext.Current.User = principal;
		}

		public void AfterRequest(HttpContext httpContext)
		{
		}
	}
}
